class Person {
  late String name;
  late int age;

  Person(this.name, this.age);

  // getter
  get userInfo {
    return "${this.name} --- ${this.age}";
  }

  getUserInfo() {
    return "${this.name} --- ${this.age}";
  }

  // setter
  set userName(name) {
    this.name = name;
  }

  setUserName(name) {
    this.name = name;
  }
}

void main() {
  Person p = new Person('张三', 30);

  print("======getter=============");
  print(p.getUserInfo());
  print(p.userInfo);

  print("======setter=============");
  p.setUserName('李四');
  print(p.name);

  p.userName = '王五';
  print(p.name);
}
